package handlers

import "fmt"

// RegisterRequest 注册请求
type RegisterRequest struct {
	Email       string `json:"email" binding:"required,email"`
	Password    string `json:"password" binding:"required"`
	VerifyCode  string `json:"verify_code" binding:"required"`
	Fingerprint string `json:"fingerprint" binding:"required"`
}

// LoginRequest 登录请求
type LoginRequest struct {
	Email       string `json:"email" binding:"omitempty,email"`
	Password    string `json:"password" binding:"omitempty"`
	Fingerprint string `json:"fingerprint" binding:"required"`
}

// SendCodeRequest 发送验证码请求
type SendCodeRequest struct {
	Email string `json:"email" binding:"required,email"`
}

// RemakePasswordRequest 重置密码请求
type RemakePasswordRequest struct {
	Email       string `json:"email" binding:"required,email"`
	VerifyCode  string `json:"verify_code" binding:"required"`
	NewPassword string `json:"new_password" binding:"required,min=6"`
}

// CreateAlipayOrderRequest 创建支付宝订单请求
type CreateAlipayOrderRequest struct {
	OrderType string `json:"order_type" binding:"required"`
	IsMobile  bool   `json:"is_mobile"`
}

// FetchConfigRequest 获取配置请求
type FetchConfigRequest struct {
	CountryCode string `form:"country_code" binding:"required"`
}

// ProxyRegisterRequest 代理注册请求
type ProxyRegisterRequest struct {
	Host     string `json:"host" binding:"required"`
	Port     int    `json:"port" binding:"required"`
	Password string `json:"password" binding:"required"`
	VIP      bool   `json:"vip"`
	Country  string `json:"country" binding:"required"`
}

func (h *ProxyRegisterRequest) Key() string {
	return fmt.Sprintf("%s:%d", h.Host, h.Port)
}

// ProxyHeartbeatRequest 代理心跳请求
type ProxyHeartbeatRequest struct {
	Host string `json:"host" binding:"required"`
	Port int    `json:"port" binding:"required"`
	Time int64  `json:"time"`
}

func (h *ProxyHeartbeatRequest) Key() string {
	return fmt.Sprintf("%s:%d", h.Host, h.Port)
}
